<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateRecordsTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('records', function(Blueprint $table)
		{
			$table->increments('id');
			$table->integer('recorderable_id')->index('recs_recder_id')->comment('记录者ID');
			$table->string('recorderable_type', 30)->comment('记录类');
			$table->integer('objectable_id')->index('recs_obj_id')->comment('记录对象ID');
			$table->string('objectable_type', 30)->comment('记录对象类');
			$table->integer('record_type_id')->comment('记录类型ID');
			$table->string('description')->comment('记录描述');
			$table->text('data', 65535)->nullable()->comment('冗余JSON数据');
			$table->timestamps();
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('records');
	}

}
